<?php
abstract class Singleton {
    protected static $objects = array();
	/**
	 * @param String $className
	 * @param array $classArgs
	 * @return Object
	 */
    public  static function getInstance($className, $classArgs = array()) {
        $argKey = md5(serialize($classArgs));
        if (false == isset(self::$objects[$className][$argKey])) {
            self::$objects[$className][$argKey] = new $className($classArgs);
        }
        
        return self::$objects[$className][$argKey];
    }

    abstract protected function __construct($classArgs = array());
}
?>